Open
Conversation
added 2 commits
December 6, 2024 17:12
The `py.typed` file is marker that signals to type checkers that the package has type annotations. This is required for tools like mypy to make use of the type annotations.
Allow all pySerial releases in the 3.X series. This relaxes the previous requirement (`==3.4`) but from looking at the changelog of `pySerial` there do not seem to be any changes in the 3.X branch that could cause any incompatibility.
5cb0690 to
a1bf261
Compare
added 2 commits
December 31, 2024 13:47
Type checkers like `mypy` do not actually run the code they are checking. This makes certain legal constructs problematic for them. In this case, constructing the `namedtuple` from the keys of a dictionary makes it impossible for the type checker to know the names of the values of the tuple. Instead, we use a `typing.NamedTuple` and list the fields manually. With this change, the type checker knows the names of the fields and their expected type.
To replicate this check, run pip install types-pyserial mypy python -m mypy -p koradctl
a1bf261 to
3bc0e04
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Update the package by
py.typedfile to signal to type checkers that the package contains type annotations;Doing this showed some issues with the current type annotation, so I went ahead and updated them. They mostly boil down to
collections.namedtuplewithtyping.NamedTupleNonechecks to the result ofissue_commandThe individual commits have more details.